<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>

		<input id="openBtn" type="button" value="打开新窗口">
		<input id="closeBtn" type="button" value="关闭新窗口">

		<script>
			var openBtn = document.getElementById('openBtn');
			var newWindow;

			openBtn.onclick = function() {
				newWindow = open('https://baidu.com');
			};
			var closeBtn = document.getElementById("closeBtn");
			closeBtn.onclick = function() {
				newWindow.close();
			}
		</script>

	</body>
</html>
